package com.hhkj.admin.invoice.service.extend.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hhkj.admin.invoice.domain.Invoice;
import com.hhkj.admin.invoice.model.dopo.InvoiceDo;
import com.hhkj.admin.invoice.model.dopo.InvoicePo;
import com.hhkj.admin.invoice.service.base.InvoiceService;
import com.hhkj.admin.invoice.service.extend.InvoiceExtendService;
import com.ruoyi.common.base.biz.service.extend.BaseExtendServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class InvoiceExtendServiceImpl
        extends BaseExtendServiceImpl<Invoice, InvoiceDo, InvoicePo, InvoiceService>
        implements InvoiceExtendService {
    @Override
    public Invoice getByOrderId(Long orderId) {
        LambdaQueryWrapper<Invoice> invoiceQuery = new LambdaQueryWrapper<>();
        invoiceQuery.eq(Invoice::getOrderId, orderId)
                .orderByDesc(Invoice::getId);
        return this.getService().getOne(invoiceQuery, false);
    }
}
